﻿@model IEnumerable<WebDomain.Entities.Product>

@{
    ViewBag.Title = "Products";
}
<h1>All Products</h1>
<br/>
<table>
    <tr>
        <th>Name</th>
        <th>Description</th>
        <th class="NumericCol">Price</th>
        <th>Actions</th>
        <th align="center">Qty.</th>
        </tr>
     @foreach (var item in Model)
     {
     <tr>
        <td id="display" width = "20%">@Html.ActionLink(item.Name, "Edit", new { item.ID })</td>
        <td id="display" width = "52%">@item.Description</td>
        <td id="display" width = "10%">@item.Price.ToString("c")</td>
        <td id="display" width = "7%">
        @using (Html.BeginForm("Delete", "Admin"))
        {
        @Html.Hidden("ID", item.ID)
        <input type="submit" value="Delete"/>
        }
        </td>
        <td id="display" width = "8%"><div>
        @using(Html.BeginForm("ChangeQty","Admin")){@Html.Hidden("ID", item.ID)
                 @:<table><td>
                 <input type="submit" value="+" name="button"/>
                 @:</td><td width = "50%" align="center">@item.Quantity</td><td>
                 <input type="submit" value="-" name="button"/>
                 @:</td></table>
                 }</div></td>
    </tr>
     }
<tr><td id="display" colspan="6"><p>@Html.ActionLink("Add a new product", "Create")</p></td></tr>
</table>
